package com.sky.mapper;

import com.sky.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import java.util.Map;

public interface UserMapper {

    @Select("select * from user where openid = #{openid}")
    User selectUserByOpenid(String openid);

    @Options(useGeneratedKeys = true,keyProperty = "id")
    @Insert("insert into user(openid, create_time) values (#{openid},#{createTime})")
    void insertUser(User user);

    /**
     * 查询用户
     *
 * @param userid
     * @return
     * @author heiheiheng
     * @create 2025/8/11
     **/
    @Select("select * from user where id=#{id}")
    User slectById(Long id);

    /**
     * 统计新增用户数量
     *
 * @param map
     * @return
     * @author heiheiheng
     * @create 2025/8/13
     **/
//    @Select("select count(*) from user where creat_time between #{begin} and #{end}")
    Integer countByMap(Map map);
}
